package com.magnificent.atlantis.common.entity.research;

import com.magnificent.commons.db.datasource.ObjectEntity;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * User: Babanin
 * Date: 25.08.2009
 * Time: 2:50:34
 */
@Entity()
@Table(name = "event")
public class ServerUserInteraction extends ObjectEntity {

    private long eventId;

    private long requestUserId;
    private long requestMessageId;
    private Date requestMessageDate;
    private MessageType requestMessageType;

    private long responseUserId;
    private long responseMessageId;
    private Date responseMessageDate;
    private MessageType responseMessageType;

    public ServerUserInteraction() {
    }

    public long getEventId() {
        return eventId;
    }

    public void setEventId(long eventId) {
        this.eventId = eventId;
    }

    public long getRequestUserId() {
        return requestUserId;
    }

    public void setRequestUserId(long requestUserId) {
        this.requestUserId = requestUserId;
    }

    public long getResponseUserId() {
        return responseUserId;
    }

    public void setResponseUserId(long responseUserId) {
        this.responseUserId = responseUserId;
    }

    public Date getRequestMessageDate() {
        return requestMessageDate;
    }

    public void setRequestMessageDate(Date requestMessageDate) {
        this.requestMessageDate = requestMessageDate;
    }

    public long getRequestMessageId() {
        return requestMessageId;
    }

    public void setRequestMessageId(long requestMessageId) {
        this.requestMessageId = requestMessageId;
    }

    public MessageType getRequestMessageType() {
        return requestMessageType;
    }

    public void setRequestMessageType(MessageType requestMessageType) {
        this.requestMessageType = requestMessageType;
    }

    public Date getResponseMessageDate() {
        return responseMessageDate;
    }

    public void setResponseMessageDate(Date responseMessageDate) {
        this.responseMessageDate = responseMessageDate;
    }

    public long getResponseMessageId() {
        return responseMessageId;
    }

    public void setResponseMessageId(long responseMessageId) {
        this.responseMessageId = responseMessageId;
    }

    public MessageType getResponseMessageType() {
        return responseMessageType;
    }

    public void setResponseMessageType(MessageType responseMessageType) {
        this.responseMessageType = responseMessageType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ServerUserInteraction)) return false;

        ServerUserInteraction that = (ServerUserInteraction) o;

        if (eventId != that.eventId) return false;
        if (requestMessageId != that.requestMessageId) return false;
        if (responseMessageId != that.responseMessageId) return false;
        if (requestMessageDate != null ? !requestMessageDate.equals(that.requestMessageDate) : that.requestMessageDate != null)
            return false;
        if (requestMessageType != that.requestMessageType) return false;
        if (responseMessageDate != null ? !responseMessageDate.equals(that.responseMessageDate) : that.responseMessageDate != null)
            return false;
        if (responseMessageType != that.responseMessageType) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (eventId ^ (eventId >>> 32));
        result = 31 * result + (int) (requestMessageId ^ (requestMessageId >>> 32));
        result = 31 * result + (requestMessageDate != null ? requestMessageDate.hashCode() : 0);
        result = 31 * result + (requestMessageType != null ? requestMessageType.hashCode() : 0);
        result = 31 * result + (int) (responseMessageId ^ (responseMessageId >>> 32));
        result = 31 * result + (responseMessageDate != null ? responseMessageDate.hashCode() : 0);
        result = 31 * result + (responseMessageType != null ? responseMessageType.hashCode() : 0);
        return result;
    }
}
